home *** CD-ROM | disk | FTP | other *** search
- /* ellipse.c */
- /* Entered by A. Wayner */
-
- /* Draw an egg-shaped curve using ellipse */
- /* and arc */
-
- # include <graphics.h>
- main()
- {
- int graphdriver = DETECT;
- int graphmode, xc, yc, yradius = 65, xradius = 50, errorcode;
-
- /* Detect adapter type and */
- /* initialize graphics system */
- initgraph( &graphdriver, &graphmode, "\\turboc");
- errorcode = graphresult();
- if( errorcode != grOk )
- {
- printf("Graphics error : %s\n",
- grapherrormsg( errorcode ));
- exit( 1 );
- }
-
- xc = getmaxx()/2;
- yc = getmaxy()/2;
-
- /* Draw half an ellipse followed */
- /* by a semicircle */
- ellipse( xc, yc, 0, 180, xradius, yradius );
- arc ( xc, yc, 180, 360, xradius );
-
- /* Explain what we've done */
- settextjustify( CENTER_TEXT, CENTER_TEXT );
- settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 1 );
-
- outtextxy( xc, 50, "An egg using arc, ellipse");
- outtextxy( xc, 2*yc-50,"Press any key to exit : ");
-
- getch(); /* Wait until a key is pressed */
- closegraph(); /* Exit graphics library */
-
- }
-